/*****************************************************************
**                                                              **
**  Copyright (C) 2004 Amlogic,Inc.                             **
**  All rights reserved                                         **
**        Filename : aw_avi_app.c /Project:AVOS                ** 
**        Revision : 1.0                                        **
**                                                              **
*****************************************************************/
#ifndef __AW_AML_NETWORK_H_
#define __AW_AML_NETWORK_H_

#include "net/iwconfig/iwlib.h"

/**
 *  These are a subset of normal iw_config and netif_setting
 *  structure for Kodak to conserve EEPROM space.
 */

 #define AP_MAX_KEY_LEN 32
 #define RSS_MAX_USENAME_LEN 32
 #define RSS_MAX_PASSPHRASE_LEN 16
struct aml_iw_config {
    char essid[IW_ESSID_MAX_SIZE + 1]; /* Wireless ESSID name */
    unsigned char mode;                /* Wireless mode (infrastructure=2(IW_MODE_INFRA), ad-hoc=1(IW_MODE_ADHOC)) */
    unsigned char security;            /* Wireless security (open=0, wep=1, wpa=2 */
    unsigned char key[IW_ENCODING_TOKEN_MAX];   /* WPA/WEP key */
    unsigned char key_len;             /* Key length */
};

struct aml_netif_setting
{
    unsigned char status;
    unsigned char dhcp;
    struct in_addr ipaddr;
    struct in_addr netmask;
    struct in_addr gateway;
    struct in_addr primary_dns;
    struct in_addr secondary_dns;
};

typedef struct login_info {
	char username[32];
	char passphrase[16];	
}yahoo_login_info_t;

typedef struct login_info yahoo_login_info_t;
typedef struct login_info google_login_info_t;
typedef struct login_info framechannel_login_info_t;

typedef struct ap_info {
	char ssid[IW_ESSID_MAX_SIZE+1];
	u8_t sig_strength;
	u8_t sig_quality;
}ap_info_t;

extern struct aml_iw_config aml_wireless_config;

void Dynamic_IP(void);
//void Setup_IP(char *ptr);
//void Setup_Mask(char *ptr);
//void Setup_Gateway(char *ptr);
//void Setup_PrimaryDNS(char *ptr);
//void Setup_SecondaryDNS(char *ptr);
#define MAX_UPNPDEVICE_NUM              10
#define MAX_DEVICE_NAME_LENGTH          50

void UI_Display_Scanresult(struct iwscan_state *state);
void Enable_Time_Sync(void);
void Disable_Time_Sync(void);
INT32S Creat_UPnP_Scan_Timer(void);
int Start_Scan(void);
void Start_Connect(struct aml_iw_config *config);
void Set_WiFi_Status(int status);
void Set_Time_Zone(short i);
int Get_Security_Setting(struct iwscan_state *state, char *ssid);
void Setup_Static_IP(char *ipaddr, char *maskaddr, char *gatewayaddr, char *pridnsaddr, char *secondary_dns);
int Get_UPnPServer_List(void);
void UPnP_Scan_Timer_Func(void);
//void UI_Display_UPnP_List(void);
extern char UPnPdevice_Name[MAX_UPNPDEVICE_NUM][MAX_DEVICE_NAME_LENGTH]; 
extern int WEP_key_Verify(char *ptr,short num,char *Hexadecimal);

extern int Get_AP_Mode_Setting(struct iwscan_state *state, char *ssid);
extern void UPnPRegisterDeviceDescription(void);

#define EGAL_GET_ALBUM                        1
#define EGAL_USERNAME_PASSWORD                2
#define EGAL_NETWORK_OFF                      3
#define EGAL_NETWORK_ERR                      4

#define CONNECT_SUCCESSFUL		0
#define NO_NETWORK_DETECTED     1
#define CAULD_NOT_GET_IP        2
#define CAULD_NOT_CONNECT_IP    3
#define NO_IP_TO_CONNECT        4
#define NETWORK_DISABLE         5

#define DISP_AP_NAME_BAR_LENGTH		10
#define DISP_AP_NAME_INFO_LENGTH		10

#define LOGON_FLAG_MASK              (0x1<<0)
#define LOGON_TYPE_MASK              (0x7f<<1)
#define LOGON_SHOWCURSOR_MASK        (0x1<<8)

#define LOGON_FLAG                0x1
#define LOGOFF_FLAG               0x0

#define LOGON_TYPE_YAHOO         (0x1<<1)
#define LOGON_TYPE_GOOGLE        (0x1<<2)
#define LOGON_TYPE_FRAMECHANNEL  (0x1<<3)
#define LOGON_TYPE_RSSGALLERY    (0x1<<4)

#define LOGON_SHOWCURSOR         (0x1<<8)
#define NONE 0 //no operation
#define CONNECTING 1 //connecting to a AP
#endif //__AW_KODAK_NETWORK_